using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL{
    /// <summary>
    /// Strongly-typed collection for the ManyToManyValue class.
    /// </summary>
    [Serializable]
    public partial class ManyToManyValueCollection : ReadOnlyList<ManyToManyValue, ManyToManyValueCollection>
    {        
        public ManyToManyValueCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_medianamik_ManyToManyValue view.
    /// </summary>
    [Serializable]
    public partial class ManyToManyValue : ReadOnlyRecord<ManyToManyValue>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_medianamik_ManyToManyValue", TableType.View, DataService.GetInstance("MedianamikProvider"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarLeftPrimaryNodeId = new TableSchema.TableColumn(schema);
                colvarLeftPrimaryNodeId.ColumnName = "LeftPrimaryNodeId";
                colvarLeftPrimaryNodeId.DataType = DbType.Guid;
                colvarLeftPrimaryNodeId.MaxLength = 0;
                colvarLeftPrimaryNodeId.AutoIncrement = false;
                colvarLeftPrimaryNodeId.IsNullable = false;
                colvarLeftPrimaryNodeId.IsPrimaryKey = false;
                colvarLeftPrimaryNodeId.IsForeignKey = false;
                colvarLeftPrimaryNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarLeftPrimaryNodeId);
                
                TableSchema.TableColumn colvarLeftPrimaryTypeId = new TableSchema.TableColumn(schema);
                colvarLeftPrimaryTypeId.ColumnName = "LeftPrimaryTypeId";
                colvarLeftPrimaryTypeId.DataType = DbType.Guid;
                colvarLeftPrimaryTypeId.MaxLength = 0;
                colvarLeftPrimaryTypeId.AutoIncrement = false;
                colvarLeftPrimaryTypeId.IsNullable = false;
                colvarLeftPrimaryTypeId.IsPrimaryKey = false;
                colvarLeftPrimaryTypeId.IsForeignKey = false;
                colvarLeftPrimaryTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarLeftPrimaryTypeId);
                
                TableSchema.TableColumn colvarLeftNodePropertyValueRevision = new TableSchema.TableColumn(schema);
                colvarLeftNodePropertyValueRevision.ColumnName = "LeftNodePropertyValueRevision";
                colvarLeftNodePropertyValueRevision.DataType = DbType.Int32;
                colvarLeftNodePropertyValueRevision.MaxLength = 0;
                colvarLeftNodePropertyValueRevision.AutoIncrement = false;
                colvarLeftNodePropertyValueRevision.IsNullable = true;
                colvarLeftNodePropertyValueRevision.IsPrimaryKey = false;
                colvarLeftNodePropertyValueRevision.IsForeignKey = false;
                colvarLeftNodePropertyValueRevision.IsReadOnly = false;
                
                schema.Columns.Add(colvarLeftNodePropertyValueRevision);
                
                TableSchema.TableColumn colvarLeftNodePropertyValueCultureName = new TableSchema.TableColumn(schema);
                colvarLeftNodePropertyValueCultureName.ColumnName = "LeftNodePropertyValueCultureName";
                colvarLeftNodePropertyValueCultureName.DataType = DbType.String;
                colvarLeftNodePropertyValueCultureName.MaxLength = 10;
                colvarLeftNodePropertyValueCultureName.AutoIncrement = false;
                colvarLeftNodePropertyValueCultureName.IsNullable = false;
                colvarLeftNodePropertyValueCultureName.IsPrimaryKey = false;
                colvarLeftNodePropertyValueCultureName.IsForeignKey = false;
                colvarLeftNodePropertyValueCultureName.IsReadOnly = false;
                
                schema.Columns.Add(colvarLeftNodePropertyValueCultureName);
                
                TableSchema.TableColumn colvarForeignNodeId = new TableSchema.TableColumn(schema);
                colvarForeignNodeId.ColumnName = "ForeignNodeId";
                colvarForeignNodeId.DataType = DbType.Guid;
                colvarForeignNodeId.MaxLength = 0;
                colvarForeignNodeId.AutoIncrement = false;
                colvarForeignNodeId.IsNullable = false;
                colvarForeignNodeId.IsPrimaryKey = false;
                colvarForeignNodeId.IsForeignKey = false;
                colvarForeignNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarForeignNodeId);
                
                TableSchema.TableColumn colvarRightPrimaryNodeId = new TableSchema.TableColumn(schema);
                colvarRightPrimaryNodeId.ColumnName = "RightPrimaryNodeId";
                colvarRightPrimaryNodeId.DataType = DbType.Guid;
                colvarRightPrimaryNodeId.MaxLength = 0;
                colvarRightPrimaryNodeId.AutoIncrement = false;
                colvarRightPrimaryNodeId.IsNullable = false;
                colvarRightPrimaryNodeId.IsPrimaryKey = false;
                colvarRightPrimaryNodeId.IsForeignKey = false;
                colvarRightPrimaryNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarRightPrimaryNodeId);
                
                TableSchema.TableColumn colvarRightPrimaryTypeId = new TableSchema.TableColumn(schema);
                colvarRightPrimaryTypeId.ColumnName = "RightPrimaryTypeId";
                colvarRightPrimaryTypeId.DataType = DbType.Guid;
                colvarRightPrimaryTypeId.MaxLength = 0;
                colvarRightPrimaryTypeId.AutoIncrement = false;
                colvarRightPrimaryTypeId.IsNullable = false;
                colvarRightPrimaryTypeId.IsPrimaryKey = false;
                colvarRightPrimaryTypeId.IsForeignKey = false;
                colvarRightPrimaryTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarRightPrimaryTypeId);
                
                TableSchema.TableColumn colvarRightNodePropertyValueRevision = new TableSchema.TableColumn(schema);
                colvarRightNodePropertyValueRevision.ColumnName = "RightNodePropertyValueRevision";
                colvarRightNodePropertyValueRevision.DataType = DbType.Int32;
                colvarRightNodePropertyValueRevision.MaxLength = 0;
                colvarRightNodePropertyValueRevision.AutoIncrement = false;
                colvarRightNodePropertyValueRevision.IsNullable = true;
                colvarRightNodePropertyValueRevision.IsPrimaryKey = false;
                colvarRightNodePropertyValueRevision.IsForeignKey = false;
                colvarRightNodePropertyValueRevision.IsReadOnly = false;
                
                schema.Columns.Add(colvarRightNodePropertyValueRevision);
                
                TableSchema.TableColumn colvarRightNodePropertyValueCultureName = new TableSchema.TableColumn(schema);
                colvarRightNodePropertyValueCultureName.ColumnName = "RightNodePropertyValueCultureName";
                colvarRightNodePropertyValueCultureName.DataType = DbType.String;
                colvarRightNodePropertyValueCultureName.MaxLength = 10;
                colvarRightNodePropertyValueCultureName.AutoIncrement = false;
                colvarRightNodePropertyValueCultureName.IsNullable = false;
                colvarRightNodePropertyValueCultureName.IsPrimaryKey = false;
                colvarRightNodePropertyValueCultureName.IsForeignKey = false;
                colvarRightNodePropertyValueCultureName.IsReadOnly = false;
                
                schema.Columns.Add(colvarRightNodePropertyValueCultureName);
                
                TableSchema.TableColumn colvarRightForeignPropertyId = new TableSchema.TableColumn(schema);
                colvarRightForeignPropertyId.ColumnName = "RightForeignPropertyId";
                colvarRightForeignPropertyId.DataType = DbType.Guid;
                colvarRightForeignPropertyId.MaxLength = 0;
                colvarRightForeignPropertyId.AutoIncrement = false;
                colvarRightForeignPropertyId.IsNullable = false;
                colvarRightForeignPropertyId.IsPrimaryKey = false;
                colvarRightForeignPropertyId.IsForeignKey = false;
                colvarRightForeignPropertyId.IsReadOnly = false;
                
                schema.Columns.Add(colvarRightForeignPropertyId);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["MedianamikProvider"].AddSchema("vw_medianamik_ManyToManyValue",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public ManyToManyValue()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public ManyToManyValue(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public ManyToManyValue(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public ManyToManyValue(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("LeftPrimaryNodeId")]
        [Bindable(true)]
        public Guid LeftPrimaryNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("LeftPrimaryNodeId");
		    }
            set 
		    {
			    SetColumnValue("LeftPrimaryNodeId", value);
            }
        }
	      
        [XmlAttribute("LeftPrimaryTypeId")]
        [Bindable(true)]
        public Guid LeftPrimaryTypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("LeftPrimaryTypeId");
		    }
            set 
		    {
			    SetColumnValue("LeftPrimaryTypeId", value);
            }
        }
	      
        [XmlAttribute("LeftNodePropertyValueRevision")]
        [Bindable(true)]
        public int? LeftNodePropertyValueRevision 
	    {
		    get
		    {
			    return GetColumnValue<int?>("LeftNodePropertyValueRevision");
		    }
            set 
		    {
			    SetColumnValue("LeftNodePropertyValueRevision", value);
            }
        }
	      
        [XmlAttribute("LeftNodePropertyValueCultureName")]
        [Bindable(true)]
        public string LeftNodePropertyValueCultureName 
	    {
		    get
		    {
			    return GetColumnValue<string>("LeftNodePropertyValueCultureName");
		    }
            set 
		    {
			    SetColumnValue("LeftNodePropertyValueCultureName", value);
            }
        }
	      
        [XmlAttribute("ForeignNodeId")]
        [Bindable(true)]
        public Guid ForeignNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("ForeignNodeId");
		    }
            set 
		    {
			    SetColumnValue("ForeignNodeId", value);
            }
        }
	      
        [XmlAttribute("RightPrimaryNodeId")]
        [Bindable(true)]
        public Guid RightPrimaryNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("RightPrimaryNodeId");
		    }
            set 
		    {
			    SetColumnValue("RightPrimaryNodeId", value);
            }
        }
	      
        [XmlAttribute("RightPrimaryTypeId")]
        [Bindable(true)]
        public Guid RightPrimaryTypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("RightPrimaryTypeId");
		    }
            set 
		    {
			    SetColumnValue("RightPrimaryTypeId", value);
            }
        }
	      
        [XmlAttribute("RightNodePropertyValueRevision")]
        [Bindable(true)]
        public int? RightNodePropertyValueRevision 
	    {
		    get
		    {
			    return GetColumnValue<int?>("RightNodePropertyValueRevision");
		    }
            set 
		    {
			    SetColumnValue("RightNodePropertyValueRevision", value);
            }
        }
	      
        [XmlAttribute("RightNodePropertyValueCultureName")]
        [Bindable(true)]
        public string RightNodePropertyValueCultureName 
	    {
		    get
		    {
			    return GetColumnValue<string>("RightNodePropertyValueCultureName");
		    }
            set 
		    {
			    SetColumnValue("RightNodePropertyValueCultureName", value);
            }
        }
	      
        [XmlAttribute("RightForeignPropertyId")]
        [Bindable(true)]
        public Guid RightForeignPropertyId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("RightForeignPropertyId");
		    }
            set 
		    {
			    SetColumnValue("RightForeignPropertyId", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string LeftPrimaryNodeId = @"LeftPrimaryNodeId";
            
            public static string LeftPrimaryTypeId = @"LeftPrimaryTypeId";
            
            public static string LeftNodePropertyValueRevision = @"LeftNodePropertyValueRevision";
            
            public static string LeftNodePropertyValueCultureName = @"LeftNodePropertyValueCultureName";
            
            public static string ForeignNodeId = @"ForeignNodeId";
            
            public static string RightPrimaryNodeId = @"RightPrimaryNodeId";
            
            public static string RightPrimaryTypeId = @"RightPrimaryTypeId";
            
            public static string RightNodePropertyValueRevision = @"RightNodePropertyValueRevision";
            
            public static string RightNodePropertyValueCultureName = @"RightNodePropertyValueCultureName";
            
            public static string RightForeignPropertyId = @"RightForeignPropertyId";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
